package boogui.member;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;

import boogui.member.db.BooguiDAO;
import boogui.member.db.BooguiDBVO;
import boogui.member.db.IBooguiDAO;

public class MemberLoginDAO {
	IBooguiDAO bdao = null;
	BooguiDBVO bdbvo = null;

	public MemberLoginDAO() {
		bdao = new BooguiDAO();
		bdbvo = new BooguiDBVO();
	}

	// 로그인
	public String selectPwd(String id) {
		Connection conn = null;
		PreparedStatement pstmt = null;
		ResultSet rs = null;
		String result = "";

		try {
			conn = bdao.openDatabase();
			pstmt = conn.prepareStatement(bdbvo.getSelectPwdSQL());
			pstmt.setString(1, id);
			rs = pstmt.executeQuery();
			if (rs.next()) {
				result = rs.getString("mempwd");
			}
		} catch (Exception ex) {
			ex.printStackTrace();
		} finally {
			bdao.closeDatabase(conn, pstmt, rs);
		}
		return result;
	}
}
